<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>gainslider</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="gain.html" title="gain" />
    <link rel="next" href="gauss.html" title="gauss" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">gainslider</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="gain.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="gauss.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="gainslider"></a>
      <div class="titlepage"></div>
      <a id="IndexGainslider" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">gainslider</span>
        </h2>
        <p>gainslider — 
      An implementation of a logarithmic gain curve which is similar to the gainslider~ object from Cycling 74 Max / MSP.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp112260288"></a>
        <h2>Description</h2>
        <p>
      This opcode is intended for use to multiply by an audio signal to give a console mixer like feel. There is no bounds in the
      source code so you can for example give higher than 127 values for extra amplitude but possibly clipped audio.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp112261952"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">kout <span class="command"><strong>gainslider</strong></span> kindex</pre>
      </div>
      <div class="refsect1">
        <a id="idp112264096"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>kindex</em></span> -- Index value. Nominal range from 0-127. For example a range of 0-152 will give you a range from -∞ to +18.0 dB. 
    </p>
        <p>
      <span class="emphasis"><em>kout</em></span> -- Scaled output. 
    </p>
      </div>
      <div class="refsect1">
        <a id="idp112266816"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the gainslider opcode. It uses the file <a class="ulink" href="examples/gainslider.csd" target="_top"><em class="citetitle">gainslider.csd</em></a>.
      
      </p>
        <div class="example">
          <a id="idp112268592"></a>
          <p class="title">
            <strong>Example 341. Example of the gainslider opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
<span class="comment">; Audio out   Audio in    Silent</span>
-odac           -iadc     -d    <span class="comment">;;;realtime output</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span>	<span class="op">=</span>	48000
<span class="ohdr">ksmps</span>	<span class="op">=</span>	100
<span class="ohdr">nchnls</span>	<span class="op">=</span>	2

		<span class="oblock">instr</span>	1	<span class="comment">; gainslider test</span>

<span class="comment">; uncomment for realtime midi</span>
<span class="comment">;kmod	ctrl7	1, 1, 0, 127</span>

<span class="comment">; uncomment for non realtime</span>
km0d <span class="opc">phasor</span> 1<span class="op">/</span>10
kmod <span class="opc">scale</span> km0d, 127, 0

kout	<span class="opc">gainslider</span>	kmod

	<span class="opc">printks</span>	"kmod <span class="op">=</span> <span class="op">%</span>f  kout <span class="op">=</span> <span class="op">%</span>f\\n", 0.1, kmod, kout

aout	<span class="opc">diskin2</span>	"fox.wav", 1, 0, 1

aout	<span class="op">=</span>	aout<span class="op">*</span>kout

	<span class="opc">outs</span>	aout, aout

		<span class="oblock">endin</span>

<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="stamnt">i</span>1	0	30
<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp112272928"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="scale.html" title="scale"><em class="citetitle">scale</em></a>,
      <a class="link" href="logcurve.html" title="logcurve"><em class="citetitle">logcurve</em></a>,
      <a class="link" href="expcurve.html" title="expcurve"><em class="citetitle">expcurve</em></a>
    </p>
      </div>
      <div class="refsect1">
        <a id="idp112276960"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: David Akbari</td>
          </tr>
          <tr>
            <td>October</td>
          </tr>
          <tr>
            <td>2006</td>
          </tr>
        </table>
        <p>
    </p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="gain.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="gauss.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">gain </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> gauss</td>
        </tr>
      </table>
    </div>
  </body>
</html>
